home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / Drivers / vc_2_2.lha / ParNet / Source / unit_ctl.c < prev    next >
C/C++ Source or Header  |  1994-11-01  |  2KB  |  111 lines

  1. /*
  2. ** $Header: SRC:CVSROOT/Vector/ParNet/unit_ctl.c,v 1.1.1.1 1994/06/23 02:39:42 Barnard Exp $
  3. */
  4.  
  5. /*
  6. ** This code was originally written by Matthew Dillon and put into Public Domain
  7. **
  8. ** All changes concerning the adaption of Matt's original code to the
  9. ** Vector Connection I/O board are © 1991-1994 by Henning Schmiedehausen
  10. ** All rights for this changes are reserved. The original code is Public Domain
  11. **
  12. ** This code is distributed with the expressed written permission of Matthew
  13. ** Dillon (Thank you very much, Matt)
  14. **
  15. */
  16.  
  17. /*
  18.  *  UNIT_CTL.C
  19.  *
  20.  *  Control Unit.  Used for global control, sink null as far as
  21.  *           read & write goes.
  22.  */
  23.  
  24. #include "defs.h"
  25.  
  26. #include "unit_ctl_protos.h"
  27. #include "parnet_protos.h"
  28. #include "task_protos.h"
  29.  
  30. #include <proto/exec.h>
  31. #include <stdlib.h>
  32. #include <stddef.h>
  33. #include <string.h>
  34.  
  35. #include "parnet_asm.h"
  36.  
  37. void CtlBeginIO();
  38. void CtlAbortIO();
  39. void CtlClose();
  40. void CtlData();
  41.  
  42. static short   CtlRefs = 0;
  43.  
  44. void
  45. UnitControlOpen(iob, unitnum, flags)
  46. Iob *iob;
  47. long unitnum;
  48. long flags;
  49. {
  50.     Unit *unit = AllocUnit(iob, CtlBeginIO, CtlAbortIO, CtlData, CtlClose);
  51.  
  52.     ++CtlRefs;
  53.  
  54.     iob->io_Unit = unit;
  55.     iob->io_Port = 0;
  56.     iob->io_Addr = 0;
  57. }
  58.  
  59. void
  60. CtlData(cmd, unit, packet)
  61. Unit *unit;
  62. Packet *packet;
  63. {
  64.     FreeParPacket(packet);
  65. }
  66.  
  67.  
  68. void
  69. CtlClose(iob)
  70. Iob *iob;
  71. {
  72.     FreeUnit(iob->io_Unit);
  73.  
  74.     --CtlRefs;
  75.  
  76.     iob->io_Unit = NULL;
  77. }
  78.  
  79. void
  80. CtlBeginIO(iob)
  81. Iob *iob;
  82. {
  83.     iob->io_Error = 0;
  84.     iob->io_Actual = 0;
  85.     iob->io_Message.mn_Node.ln_Type = NT_MESSAGE;
  86.  
  87.     switch(iob->io_Command) {
  88.     case PPD_SETADDR:    /*  set network address     */
  89.     ParAddress(iob->io_Addr);
  90.     DevBase->ParAddress = iob->io_Addr;
  91.     WriteConfig();
  92.     break;
  93.     case PPD_SETTO:    /*  set network timeout     */
  94.     ParLLTimeout = iob->io_Offset;
  95.     WriteConfig();
  96.     break;
  97.     default:
  98.     iob->io_Error = IOERR_NOCMD;
  99.     break;
  100.     }
  101.     if ((iob->io_Flags & IOF_QUICK) == 0)
  102.     ReplyMsg(&iob->io_Message);
  103. }
  104.  
  105. void
  106. CtlAbortIO(iob)
  107. Iob *iob;
  108. {
  109. }
  110.  
  111.